
using System;
using System.Collections;
using System.Web.UI.WebControls;

using Awaken.Framework;
using Nullables;

namespace Pubs.Domain.Entities
{
    public partial class Job : IEntity
    {
        protected static JobBroker broker;
        public static JobBroker Broker
        {
            get
            {
                if (broker == null)
                {
                    broker = new JobBroker();
                }
                return broker;
            }
        }

        #region IEntity Members

        public string EntityID
        {
            get { return string.Empty; }
        }
        
        public string EntityName
        {
            get { return string.Empty; }
        }

        public void Save()
        {
            Broker.Save(this);
        }
        
        public void Delete()
        {
            Broker.Delete(this);
        }
        
        #endregion
    
        #region Constructor
        
        public Job()
        {
            // Default, no arg constructor.
        }
        
        #endregion
            
        #region Public Properties / Protected Fields
                        
        
        protected System.Int16? _JobId;
        public System.Int16? JobId
        {
            get{ return _JobId; }
            set{ _JobId=value; }
        }
        
        protected string _JobDesc;
        public string JobDesc
        {
            get{ return _JobDesc; }
            set{ _JobDesc=value; }
        }
        
        protected byte _MinLvl;
        public byte MinLvl
        {
            get{ return _MinLvl; }
            set{ _MinLvl=value; }
        }
        
        protected byte _MaxLvl;
        public byte MaxLvl
        {
            get{ return _MaxLvl; }
            set{ _MaxLvl=value; }
        }
        
        
        
        // One-To-Many: employee.job_id  
        protected IList _EmployeeList;
        public IList EmployeeList
        {
            get{ return _EmployeeList; }
            set{ _EmployeeList=value; }
        }
        
        
                
        
        
        
        #endregion
    }
    
    #region JobBroker

    public partial class JobBroker : IBroker
    {
        #region IBroker Members

        public Type EntityType
        {
            get { return typeof(Job); }
        }
        
        public Job GetByID(object id)
        {
            return (Job)Awaken.Framework.Gateway.GetByID(EntityType, id);
        }

        public IList GetAll()
        {
            return Awaken.Framework.Gateway.GetAll(EntityType);
        }

        public void Save(IEntity entity)
        {
            Awaken.Framework.Gateway.Save(entity);
        }
        
        public void Delete(IEntity entity)
        {
            Awaken.Framework.Gateway.Delete(entity);
        }
        
        #endregion
    }
    #endregion
}
